package com.css.JUC01;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CallableTest {
//    callable可获取返回值
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCall myCall=new MyCall();
        FutureTask f=new FutureTask(()->{
            return myCall.call();
        });
        new Thread(f,"A").start();
        System.out.println(f.get());
    }
}
class MyCall {

    public Integer call()  {
        System.out.println("执行了call");
        return 1024;
    }
}
